<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改地址资料')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-subscriber-edit" th:object="${baseSubscriber}">
            <input name="subscriberId" th:field="*{subscriberId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">上级地址：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
                        <input class="form-control" type="text" onclick="selectSubscriberTree()" id="treeName" readonly="true" th:field="*{parentName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">地址全称：</label>
                <div class="col-sm-8">
                    <input name="subscriberName" th:field="*{subscriberName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">地址简称：</label>
                <div class="col-sm-8">
                    <input name="subscriberShort" th:field="*{subscriberShort}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">计费面积：</label>
                <div class="col-sm-8">
                    <input name="subscriberCharge" th:field="*{subscriberCharge}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">建筑面积：</label>
                <div class="col-sm-8">
                    <input name="subscriberBuild" th:field="*{subscriberBuild}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">地址类型：</label>
                <div class="col-sm-8">
                    <select name="subscriberType" class="form-control m-b" th:with="type=${@dict.getType('subscriber_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{subscriberType}"></option>
                    </select>
                </div>
            </div>


            <div class="form-group">    
                <label class="col-sm-3 control-label">用户属性：</label>
                <div class="col-sm-8">
                    <select name="subscriberParty" class="form-control m-b" th:with="type=${@dict.getType('subscriber_party')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{subscriberParty}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">用户号：</label>
                <div class="col-sm-8">
                    <input name="subscriberPartyno" th:field="*{subscriberPartyno}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">通道号：</label>
                <div class="col-sm-8">
                    <input name="subscriberNum" th:field="*{subscriberNum}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "module/subscriber";
        $("#form-subscriber-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-subscriber-edit').serialize());
            }
        }

        /*地址资料-新增-选择父部门树*/
        function selectSubscriberTree() {
            var options = {
                title: '地址资料选择',
                width: "380",
                url: prefix + "/selectSubscriberTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>